# from PIL import Image
# from torch.utils.tensorboard import SummaryWriter
# from torchvision import transforms
#
# img_path="D:\\PytorchLearn\\pytorch_learning\\Project1\\ants_image\\0013035.jpg"
# img=Image.open(img_path)
# writer= SummaryWriter("logs")
#
#
# tensor_trans=transforms.ToTensor()
# tensor_img=tensor_trans(img)
#
#
# writer.add_image("Tensor_img",tensor_img)
# writer.close()
from PIL import Image
from torch.utils.tensorboard import SummaryWriter
from torchvision import transforms

writer=SummaryWriter("logs")
img=Image.open("D:\\PytorchLearn\\pytorch_learning\\Project1\\images\\capture_20221115110104367.bmp")

# ToTensor的使用
trans_totensor=transforms.ToTensor()
img_tensor=trans_totensor(img);
writer.add_image("TOTensor",img_tensor)


# Normalize
print(img_tensor[0][0][0])
trans_norm=transforms.Normalize([1,3,5],[5,5,1])
img_norm=trans_norm(img_tensor)
print(img_norm[0][0][0])
writer.add_image("Normalize",img_norm,1)
writer.close()
